revive/types: Implement the ethereum 7702 transaction#9538
revive/types: Implement the ethereum 7702 transaction#9538lexnv merged 15 commits intolexnv/minimal-poc-block-storagefrom
Conversation
Signed-off-by: Alexandru Vasile <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
|
Ah i think I implemented here as well, both pr should be pretty similar I guess, If you can pickup any differences with this one let me know |
|
will merge the diff in #9177 |
|
@lexnv re-opening here, but I think we should merge master and fix it up once the other PR mentioned above is merged |
| s.append(&self.r); | ||
| s.append(&self.s); | ||
| s.append(&self.y_parity); |
There was a problem hiding this comment.
I think the order is wrong here
There was a problem hiding this comment.
Thanks for the catch! 🙏 Yep it looks to be:
authorization_list = [[chain_id, address, nonce, y_parity, r, s], ...]
Signed-off-by: Alexandru Vasile <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
|
Is it a good idea to implement the tx type without the actual functionality? We are just ignoring those new fields? |
it's moved to #9177 the tx types are rejected, when we try to convert them to call |
… into lexnv/eth-eip7702 Signed-off-by: Alexandru Vasile <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
| extra_data: self.extra_data.clone().0.into(), | ||
| mix_hash: self.mix_hash.0.into(), | ||
| nonce: self.nonce.0.into(), | ||
| // <<<<<<< HEAD |
There was a problem hiding this comment.
What's the purpose of leaving this commented section?
| .collect(); | ||
| // Sort by nibble key. | ||
| // This gives the right lexicographical order to add leaves to the trie. | ||
| pairs.sort_by(|x, y| x.0.cmp(&y.0)); |
There was a problem hiding this comment.
After investigating the trie root computation we know that pair at index 0 has key 0x80 and should be moved at position 0x80 or last (if number of elements is less than 0x80). No need to sort.
This PR compares the incremental trie builder approach with the in-storage approach. This uses real-life ethereum blocks to determine how many bytes we need to store. ### Storage Usage In the worst-case scenario, the validator needs to store in RAM 8004 bytes vs 80538 bytes. This represents roughly 9.9% of the initial data. At a minimum, best case scenario, the validator needs to sore just 406 bytes. This represents roughly 0.5% of the initial data. ``` For tx=6 using index=7 HB size is: 8004 vs total 80538 For tx=64 using index=65 HB size is: 406 vs total 80538 ``` This approach shows that we can optimize the storage items from (between 90-99%): - #9418 ### Implementation Idea Currently, we hold in the storage of pallet/revive the RLP encoded transaction bytes. This represents a [Vec<Vec<u8>>](https://github.com/paritytech/polkadot-sdk/pull/9418/files#diff-f55a8416f5e8564cb4463b5f11dfd00d7c865aabab747a05887feeedd4e1c81dR570-R571) that is used to build the transaction trie root hash. Instead, we place a newly added low-level structure `IncrementalTrieBuilder` into an `environmental` variable. When we receive a transaction, instead of pushing it to the `Vec<Vec<u8>>`, we add it to the low-level builder. This effectively will use the `8004` bytes plus the RLP encodings of a maximum of 2 transactions. --------- Signed-off-by: Alexandru Vasile <[email protected]> Signed-off-by: Andrei Sandu <[email protected]> Signed-off-by: Cyrill Leutwiler <[email protected]> Signed-off-by: xermicus <[email protected]> Co-authored-by: Serban Iorga <[email protected]> Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: muharem <[email protected]> Co-authored-by: Oliver Tale-Yazdi <[email protected]> Co-authored-by: Evgeny Snitko <[email protected]> Co-authored-by: alvicsam <[email protected]> Co-authored-by: Alexander Samusev <[email protected]> Co-authored-by: sistemd <[email protected]> Co-authored-by: Veronika Romashkina <[email protected]> Co-authored-by: Raymond Cheung <[email protected]> Co-authored-by: Andrei Eres <[email protected]> Co-authored-by: Haiko Schol <[email protected]> Co-authored-by: Andrei Sandu <[email protected]> Co-authored-by: Francisco Aguirre <[email protected]> Co-authored-by: Karol Kokoszka <[email protected]> Co-authored-by: Clara van Staden <[email protected]> Co-authored-by: PG Herveou <[email protected]> Co-authored-by: Alexander Theißen <[email protected]> Co-authored-by: xermicus <[email protected]> Co-authored-by: 0xRVE <[email protected]> Co-authored-by: Robert van Eerdewijk <[email protected]> Co-authored-by: Sebastian Miasojed <[email protected]> Co-authored-by: Cyrill Leutwiler <[email protected]> Co-authored-by: Rodrigo Quelhas <[email protected]> Co-authored-by: Javier Viola <[email protected]> Co-authored-by: Bastian Köcher <[email protected]> Co-authored-by: Bastian Köcher <[email protected]> Co-authored-by: Michal Kucharczyk <[email protected]> Co-authored-by: Ron <[email protected]> Co-authored-by: Lukasz Rubaszewski <[email protected]> Co-authored-by: Alexander Cyon <[email protected]> Co-authored-by: Alexander Cyon <[email protected]> Co-authored-by: Dmitry Sinyavin <[email protected]> Co-authored-by: s0me0ne-unkn0wn <[email protected]> Co-authored-by: Paolo La Camera <[email protected]> Co-authored-by: Andrei Sandu <[email protected]> Co-authored-by: Sebastian Kunert <[email protected]> Co-authored-by: Guillaume Thiolliere <[email protected]> Co-authored-by: Sebastian Miasojed <[email protected]> Co-authored-by: Egor_P <[email protected]> Co-authored-by: Bruno Devic <[email protected]> Co-authored-by: Kian Paimani <[email protected]> Co-authored-by: Ankan <[email protected]> Co-authored-by: Alin Dima <[email protected]> Co-authored-by: Klapeyron <[email protected]> Co-authored-by: Branislav Kontur <[email protected]> Co-authored-by: drskalman <[email protected]> Co-authored-by: Davide Galassi <[email protected]> Co-authored-by: Michael Müller <[email protected]> Co-authored-by: Doordashcon <[email protected]> Co-authored-by: Andrii <[email protected]>
4009539
into
lexnv/minimal-poc-block-storage
|
All GitHub workflows were cancelled due to failure one of the required jobs. |
|
All GitHub workflows were cancelled due to failure one of the required jobs. |
Signed-off-by: Alexandru Vasile <[email protected]>
…ons (#9764) This is a combination of: - #9538 - #9554 - Because I've merged origin/master into the 3 PR in the tree series, which led to reporting all in-between commits as part of the PRs For tracking purposes only. --------- Signed-off-by: Alexandru Vasile <[email protected]> Co-authored-by: Lukasz Rubaszewski <[email protected]>
This PR implements the Ethereum 7702 transaction:
While at it, have added a few serialization tests to ensure our block decoding doesn't panic.
Builds opon: #9418
Closes: paritytech/contract-issues#146
Part of: paritytech/contract-issues#139